<?php require_once 'header.php';?>    
<!-- DataTables Responsive CSS -->
    <link href="sb2/vendor/datatables-responsive/dataTables.responsive.css" rel="stylesheet">
        <!-- Page Content -->
        <div id="page-wrapper">
            <div class="container-fluid">
                <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
							<span class="xxf_red" style="float:right;">[!!!系统数据备份，请在空闲时间操作！<input type="button" value="备份" onclick="bak()">!!!]</span>
                            <?php echo XXF_LNAME?>
                            <a href="qxmanage/type/all/lid/2">批量操作</a>
                            <br>
                            <select id="uid">
                                	<option>选择人员</option>
                            	<?php
                                	$i=0;
                                	foreach ($userselect as $row){$i++;
                                	?>
                                    <option value="<?php echo $row['id']?>"><?php echo $row['id']?><?php echo $row['realname']?>(<?php echo $row['mphone']?>)</option>
                                	<?php 
                                	}
                                	?>
                            </select>
                            <select id="lid">
                                	<option>选择栏目</option>
                            	<?php
                                	$i=0;
                                	foreach ($listselect as $row){$i++;
                                	?>
                                    <option value="<?php echo $row['id']?>"><?php echo $row['lname']?></option>
                                	<?php 
                                	}
                                	?>
                            </select>
                            <input type="button" id="add" value="授权" onclick="add()">
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example">
                                <thead>
                                    <tr>
                                        <th>ID</th>
                                        <th>姓名</th>
                                        <th>栏目</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                	<?php
                                	$i=0;
                                	foreach ($result as $row){$i++;
                                	?>
                                    <tr class="<?php echo $i%2==0?"even":"odd";?> gradeA" id='<?php echo $row['ulid'];?>'>
                                    	<td><?php echo $row['uid'];?></td>
                                    	<td><?php echo $row['realname'];?> <?php echo $row['username'];?></td>
                                        <td><?php echo $row['lname'];?></td>
                                        <td><a href="javascript:del(<?php echo $row['ulid']?>)">删除</a></td>
                                    </tr>
                                	<?php 
                                	}
                                	?>
                                </tbody>
                            </table>
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
             </div>
        </div>
        <!-- /#page-wrapper -->
  </div>
        <!-- DataTables JavaScript -->
<?php require_once 'bottom.php';?>
    <script src="sb2/vendor/datatables/js/jquery.dataTables.js"></script>
    <script src="sb2/vendor/datatables-plugins/dataTables.bootstrap.min.js"></script>
    <script src="sb2/vendor/datatables-responsive/dataTables.responsive.js"></script>
    <script>
    $(document).ready(function() {
        $('#dataTables-example').DataTable({
            responsive: true,
            "aaSorting": [[ 0, "desc" ]]
        });
    });
	function bak(){
		$.post("qxmanage",{type:"bak"},function(data){
			$.xalert(data);
		});
	}
    function del(ulid){
		$.xconfirm("删除后无法恢复，确定要删除此条记录么？",function(data){
 			if(data){
				$.xpost("<?php echo XXF_HTTP?>qxmanage",{type:'del',ulid:ulid},function(data1){
					if(data1==0){
						$.xloading(0);
						$.xalert("删除失败");
					}else{
						window.location.reload();
					}
				}); 
			} 
		});
    }
    function add(){
    	$.xconfirm("确定添加？",function(data){
 			if(data){
 	 			var uid=$("#uid").val();
 	 			var lid=$("#lid").val();
				$.xpost("<?php echo XXF_HTTP?>qxmanage",{type:'add',uid:uid,lid:lid},function(data1){
					if(data1==0){
						$.xloading(0);
						$.xalert("添加失败");
					}else{
						window.location.reload();
					}
				}); 
			} 
		});
    }    
    </script>